
//
//  LJHFindTableViewCell.m
//  HEARME
//
//  Created by mac on 16/2/24.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "LJHFindTableViewCell.h"

@implementation LJHFindTableViewCell

- (void)dealloc
{
    [_newsDigest release];
    [_newsPic release];
    [_newsTitle release];
    [_nextBtn release];
    [super dealloc];
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createCell];
    }
    
    return self;
}

-(void)createCell
{
    self.newsPic = [[UIImageView alloc] initWithFrame:CGRectMake(self.contentView.bounds.origin.x + WIDTH*0.03, self.contentView.bounds.origin.y + WIDTH*0.03, WIDTH*0.18, WIDTH*0.18) ];
    self.newsPic.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.newsPic];
    [_newsPic release];
    
    self.newsTitle = [[LJHBaseLable alloc] initWithFrame:CGRectMake(self.newsPic.frame.origin.x + self.newsPic.frame.size.width + HEIGHT*0.01, self.contentView.bounds.origin.y + HEIGHT*0.02, 200*WIDTH/375, 20*HEIGHT/667)];
    self.newsTitle.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.newsTitle];
    [_newsTitle release];
    
    self.newsDigest = [[LJHBaseLable alloc] initWithFrame:CGRectMake(self.newsPic.frame.origin.x + self.newsPic.frame.size.width + 10 ,self.newsTitle.frame.origin.y + self.newsTitle.frame.size.height + 10, 200*WIDTH/375, 20*HEIGHT/667)];
    self.newsDigest.backgroundColor = [UIColor clearColor];
    self.newsDigest.font = [UIFont systemFontOfSize:13 weight:0];
    [self.contentView addSubview:self.newsDigest];
//    self.newsDigest.textColor = [UIColor lightGrayColor];
    self.newsDigest.numberOfLines = 2;
    [_newsDigest release];
    
    
    self.nextBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.nextBtn.frame = CGRectMake(WIDTH-40, self.newsPic.frame.origin.y + self.newsPic.frame.size.height/2-15, WIDTH*0.1, WIDTH*0.1);
    self.nextBtn.backgroundColor = [UIColor clearColor];
    [self.nextBtn setImage:[UIImage imageNamed:@"cell_arrow@2x.png"] forState:UIControlStateNormal];
    [self.contentView addSubview:self.nextBtn];
    

}

-(void)setModel:(LJHChildListModel *)model
{
    if (_model != model) {
        
        [_model release];
        _model = [model retain];
    }
    
    NSURL *url = [NSURL URLWithString:model.coverPath];
    [self.newsPic sd_setImageWithURL:url placeholderImage:PLACEHOLDER];
    self.newsTitle.text = model.title;
    self.newsDigest.text = model.subtitle;
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
